✨ BCA JUL24 Batch ✨

Join Our WhatsApp Group

Anukasif Pic

4.4 - Arrays in Programming - MCQs

Interactive MCQs Quiz

Test your knowledge with these questions

1. What is an array in programming?

2. How do you declare a one-dimensional array in C?

3. Which of the following accesses the third element of an array named arr?

4. What will be the output of the following code?

                    int arr[3] = {1, 2, 3};
                    printf("%d", arr[1]);
                

5. What is the result of trying to access an out-of-bounds index in an array?

6. Which of the following statements correctly passes an array to a function in C?

7. How do you define a two-dimensional array with 3 rows and 4 columns?

8. What is the output of the following code?

                    int arr[3] = {5, 10, 15};
                    printf("%d", arr[0] + arr[2]);
                

9. Which function is used to determine the size of an array in bytes?

10. What is the primary advantage of using arrays?

11. Which of the following correctly initializes an array with values?

12. Which of the following can be used to access the elements of a two-dimensional array?

13. What will happen if you declare an array with a size of 0 in C?

14. How do you pass an individual element of an array to a function?

15. In which scenario is using an array more efficient than using separate variables?

16. What will be the output of the following code?
int arr[3] = {2, 4, 6};
printf("%d", arr[0] * arr[1]);

17. What does the following declaration represent?
int (*ptr)[5];

18. Which of the following correctly accesses the last element of an array named arr with 5 elements?

19. How do you dynamically allocate memory for an array of 10 integers?

20. What will happen if you try to assign a new value to an element of an array declared as const?